package edu.fiu.cis.personalize.server.graph.update;

import edu.fiu.cis.personalize.server.graph.Document;
import edu.fiu.cis.personalize.server.graph.NodeType;
import edu.fiu.cis.personalize.server.graph.Query;

public class QueryDocumentUpdate extends GraphUpdate<Query, Document> {

	@Override
	protected double computeWeight(Query q, Document d) {
		double numDocDisplay = d.getDisplayedAfterQuery(q);
		double numClicksAfterQuery = d.getNumClickedAfterQuery(q);
		return ((double) numClicksAfterQuery / numDocDisplay);
	}


	@Override
	NodeType type1() {
		return NodeType.QUERY;
	}

	@Override
	NodeType type2() {
		return NodeType.DOCUMENT;
	}

}
